/**
 * 
 */
package com.xcn.siteinfo;

import java.io.*;

import org.jsoup.*;
import org.jsoup.nodes.*;
import org.jsoup.select.*;


/**
 * @author changmin
 *
 */
public class HTMLParser
{
	protected final static String SERVLET_PATH = "/web-playback/loader?info=";

	/**
	 * 
	 */
	public HTMLParser( )
	{
	}
	
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main ( String[] args ) throws IOException
	{
		String sneakId = "23344344";
		Document doc = Jsoup.parse ( new File ( "/users/sneak/naver.html" ), null );
		Elements links = doc.getElementsByTag ( "link" );
		for ( int i = 0 ; i < links.size ( ) ; i++ )
		{
			Element link = links.get ( i );
			String href = link.attr ( "href" );
			link.attr ( "href", SERVLET_PATH + sneakId + "_" + href );
		}
		
		links = doc.getElementsByTag ( "link" );
		for ( int i = 0 ; i < links.size ( ) ; i++ )
		{
			//Element link = links.get ( i );
			//System.out.println ( link );
		}
		System.out.println ( doc.html ( ) );
	}
	
}
